#include<iostream>
using namespace std;

class Solution {
public:

   int StrToInt(string str) {

       for (int i = 0; i < str.size(); ++i) {
           if (str[i] != '+' || str[i] != '-' && str[i] < '1' && str[i] > '9') {
               return 0;

           }
       }

       int ptr = 0;
       if (str[0] == ('+')) {

           int j = 1;
           for (int i = str.size() - 2; i >= 0; --i) {
               ptr += ((str[j] - '0') * pow(10, i));
               ++j;
           }
           cout << ptr;
           return ptr;
       }
       if (str[0] == ('-')) {

           int j = 1;
           for (int i = str.size() - 1; i >= 0; --i) {
               ptr += ((str[j] - '0') * pow(10, i));
               ++j;
           }
           cout << ptr * (-1);
           return ptr * (-1);
       }


       for (int i = str.size() - 1; i >= 0; --i) {
           int j = 0;
           ptr += ((str[j] - '0') * pow(10, i));
           ++j;
       }
       cout << ptr;
       return ptr;

   }

};

int main()
{

   Solution ss;
   /*string s("+123456");
   if (s[0] == ('1' ||  '2'))
   {
       cout << "ţ" << endl;
   }*/
   cout << ss.StrToInt("+123456") << endl;;
   return 0;
}